import http from '@/axios/http.ts'
import {
    createDictionaryRequest,
    updateDictionaryRequest,
    searchDictionaryItemRequest,
    createDictionaryItemRequest,
    updateDictionaryItemRequest
} from '@/models/dictionaryModel'

/**
 * 创建字典类型
 * @param {*} p 
 * @returns 
 */
export const createDictionary = (parmas: createDictionaryRequest) => {
    return http.post('/Sys_Dictionary/CreateDictionary', parmas);
}

/**
 * 获取字典类型列表
 * @param {*} p 
 * @returns 
 */
export const getDictionaryList = (parmas) => {
    return http.get('/Sys_Dictionary/GetDictionaryList', parmas);
}

/**
 * 删除字典项
 * @param {*} p 
 * @returns 
 */
export const delDictionary = (parmas) => {
    return http.del('/Sys_Dictionary/DeleteDictionary', parmas);
}

/**
 * 根据id获取字典
 * @param {*} p 
 * @returns 
 */
export const getDictionaryById = (parmas) => {
    return http.get('/Sys_Dictionary/GetDictionaryById', parmas);
}

/**
 * 修改字典
 * @param {*} p 
 * @returns 
 */
export const updateDictionary = (parmas: updateDictionaryRequest) => {
    return http.post('/Sys_Dictionary/UpdateDictionary', parmas);
}

/**
 * 根据字典id获取字典项列表
 */
export const getDictionaryItemListByDid = (parmas: searchDictionaryItemRequest) => {
    return http.get('/Sys_Dictionary/GetDictionaryItemListByDid', parmas);
}

/**
 * 创建字典项
 * @param {*} p 
 * @returns 
 */
export const createDictionaryItem = (parmas: createDictionaryItemRequest) => {
    return http.post('/Sys_Dictionary/CreateDictionaryItem', parmas);
}

/**
 * 获取字典项列表
 * @param {*} p 
 * @returns 
 */
export const getDictionaryItemById = (parmas: String) => {
    return http.get('/Sys_Dictionary/GetDictionaryItemById', parmas);
}

/**
 * 删除字典项
 * @param {*} p 
 * @returns 
 */
export const deleteDictionaryItem = (parmas: String) => {
    return http.del('/Sys_Dictionary/DeleteDictionaryItem', parmas);
}


/**
 * 修改字典
 * @param {*} p 
 * @returns 
 */
export const updateDictionaryItem = (parmas: updateDictionaryItemRequest) => {
    return http.post('/Sys_Dictionary/UpdateDictionaryItem', parmas);
}

/**
 * 根据字典值获取字典项
 * @param {*} p 
 * @returns 
 */
export const getDictionaryItemByCode = (parmas: String) => {
    return http.get('/Sys_Dictionary/GetDictionaryItemByCode', parmas);
}


